﻿using System;

namespace AgFractal.Fractals
{
    public class Lambda: AbstractFractal
    {
        public Lambda()
        {
            Name = Description = "Lambda";
            ID = new Guid("FD854713-21CD-4de6-A153-BA3847A1BC6D");
            R1 = -2; I1 = 1.25; R2 = 2.5; I2 = -1.75;
        }
        protected override short Calculate(double r, double i, short MaxIteration)
        {
            short j;
            Complex z = new Complex(r, i);
            Complex c = new Complex(0.85, 0.6);
            for (j = 0; j < MaxIteration; j++)
            {
                z = z * c;
                z = z * (1 - z);
                if (z.Abs2() > 4) break;
            }
            return j;
        }
    }
}